import request from "@/utils/request";
const BASE_URL = "/solution";

const SolutionAPI = {
  getList(queryParams?: Query) {
    return request<any, PageResult<PageVO[]>>({
      url: `${BASE_URL}/list`,
      method: "get",
      params: queryParams,
    });
  },
  getFormData(id: number) {
    return request({
      url: `${BASE_URL}/${id}`,
      method: "get",
    });
  },

  add(data: Form) {
    return request({
      url: `${BASE_URL}/create`,
      method: "post",
      data: data,
    });
  },

  update(data: Form) {
    return request({
      url: `${BASE_URL}/update/${data.id}`,
      method: "POST",
      data: data,
    });
  },

  deleteByIds(id: number) {
    return request({
      url: `${BASE_URL}/delete/${id}`,
      method: "get",
    });
  },
};

export default SolutionAPI;
export interface PageVO {
  id: number;
  title: string;
}

export interface Query extends PageQuery {
  keywords?: string;
}

export interface Form {
  id: number;
  title: string;
  sort: number;
}
